<?php
/**
*商户后台管理类
*@author：刘旭
**/
class businesser extends core{

	final static function index(){
		$businesser=self::head();
		if(empty($businesser)){
			self::log_in();
		}
		else
		{
			self::view(__FUNCTION__.".php",compact('businesser'));
		}
	}
    
	/**
	*网站头部信息
	*判断商户是否登陆
	*@author ：刘旭
	**/
	final static function head(){
		if(!empty($_SESSION['businesser'])&&!empty($_SESSION['businesser_id'])){
			//用户的具体信息
			$user= $_SESSION['businesser'];
		}else {
			$user="";
		}
		return $user;
	}

	/**
	*商户登陆函数
	*
	*@author ：刘旭
	**/

	final static function log_in(){
		
		if($_SERVER['REQUEST_METHOD']=='POST'){
			$error=class_businesser::log_in();
			if(empty($error)){
				header("location:businesser.php?do=index");
			}
			else{
				
				self::view(__FUNCTION__.".php",compact("error"));
			}
		}
		else
		{
			self::view(__FUNCTION__.".php");
		}

	}
	/**
	*商户退出函数
	*@author :刘旭
	**/
	final static function log_out(){
		unset($_SESSION['businesser']);
		header("location:businesser.php?do=index");
	}
	/**********商户资料***********优惠券列表**********用户评分**********消费登记（还没有做）**************/

	/**
	*商户资料
	*@author :刘旭
	**/
	final static function businesser_data(){
		 
		$businesser=self::head();//用户是否登陆
		if(!empty($businesser))
		{
		 self::view(__FUNCTION__.".php",compact("businesser"));
		}
		else
		{
		        header("location:businesser.php?do=index");
		}	
	}

	/**
	*优惠券列表
	*@author :刘旭
	**/
	final static function coupons_list(){
		$businesser=self::head();//用户是否登陆
		if(!empty($businesser))
		{
		 self::view(__FUNCTION__.".php",compact("businesser"));
		}
		else
		{
		        header("location:businesser.php?do=index");
		}	
	}

	/**
	*用户评分
	*@author :刘旭
	**/
	final static function grade(){
		$businesser=self::head();//用户是否登陆
		if(!empty($businesser))
		{
		 self::view(__FUNCTION__.".php",compact("businesser"));
		}
		else
		{
		        header("location:businesser.php?do=index");
		}	
	}
	
}
?>